package demo3;

public class My_Thread04 {
    public static void main(String[] args) {
        //实例化任务对象
        MyRunnable01 myRunnable01 = new MyRunnable01();  // 皮屑
        MyRunnable02 myRunnable02 = new MyRunnable02();  // 皮包

        //创建线程对象
        Thread thread01 = new Thread(myRunnable01);  // 皮鞋1
        Thread thread02 = new Thread(myRunnable01);  // 皮鞋2
        Thread thread03 = new Thread(myRunnable02);  // 皮包

        thread01.start();
        thread02.start();
        thread03.start();

    }
}

class MyRunnable01 implements Runnable {
    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("生产皮鞋 , 金币 + 2....");
        }
    }
}

class MyRunnable02 implements Runnable {
    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("生产皮包 , 金币 + 5....");
        }
    }
}
